<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateDeliveriesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('deliveries', function (Blueprint $table) {
            $table->bigIncrements('delivery_id');
            $table->string('order_bn', 100)->index()->comment('订单编号');
            $table->bigInteger('member_id')->comment('会员ID');
            $table->enum('type', ['delivery','return'])->default('delivery')->comment('状态: delivery 发货 Return 退货');
            $table->enum('status', ['success','failed'])->default('success')->comment('状态: success 成功 failed 失败');
            $table->string('ship_company', 100)->comment('发货公司');
            $table->string('ship_number', 30)->comment('发货单号');
            $table->text('remark')->nullable()->comment('备注');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('deliveries');
    }
}
